package org.androidpn.server.entity;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 * entity Broadcast
 * 
 * @author 蔡琪
 * 
 */
@Entity
@Table(name = "tk_broadcast")
public class Broadcast extends BaseEntity {

	private static final long serialVersionUID = 6020900406427835910L;

	/**
	 * 广播消息状态
	 * 
	 * @author 蔡琪
	 * 
	 */
	public enum BroadCastStatus {
		/** 发送中 */
		sending,
		/** 已发送 */
		send,
		/** 过期 */
		expire
	}

	/** 内容 */
	@Column(name = "content")
	private String content;

	/** 广播状态 */
	@Column(name = "status")
	private BroadCastStatus status;

	/** 管理员 */
	@ManyToOne(fetch = FetchType.LAZY)
	private Admin admin;

	@ManyToMany(mappedBy = "broadcasts")
	private Set<Role> roles = new HashSet<Role>();

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public BroadCastStatus getStatus() {
		return status;
	}

	public void setStatus(BroadCastStatus status) {
		this.status = status;
	}

	public Admin getAdmin() {
		return admin;
	}

	public void setAdmin(Admin admin) {
		this.admin = admin;
	}

	public Set<Role> getRoles() {
		return roles;
	}

	public void setRoles(Set<Role> roles) {
		this.roles = roles;
	}

}
